import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { NestExpressApplication } from '@nestjs/platform-express'
import { FormatResponseInterceptor } from './interceptor/format-response.interceptor'
import { InvokeRecordInterceptor } from './interceptor/invoke-record.interceptor'

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule)
  app.useStaticAssets('uploads', {
    prefix: '/static'
  })
  app.enableCors()
  app.useGlobalInterceptors(new FormatResponseInterceptor())
  app.useGlobalInterceptors(new InvokeRecordInterceptor())
  await app.listen(3000)
}
bootstrap()
